Home |
| Latest | About | Random
# 05b Some more applications and examples. Let us apply our method of solving linear system to analyze some problems. Of course, not every problem is a linear system of equations problem. But when it is, then oh boy we got this, we know what to do -- set up an augmented matrix, row reduce to an echelon form (EF), and go from there. If we got free variables, solve the pivot variables in terms of the free ones, and so on. ## Example. Network analysis, with balanced junctions. In a network diagram we have flows of "things" through the network, described by the number on an arrow and its directionality. Now if this network is to not have build-ups at junction, then at each junction the total flow into it must equal the total flow out of it. (This is akin to Kirchhoff's junction rule form physics for current in an electrical circuit). For example, if we adhere to this rule, then this diagram ```tikz \usepackage{tikz-cd} \begin{document} \begin{tikzcd} \arrow[dr,"z"]& & \\ & A \arrow[r,"x"]& \ \\ \arrow[ur,"y"]& & \end{tikzcd} \end{document} ``` shows that we have $z+y =x$ for the flows that goes through junction $A$. So let us consider the following network such that at each junction, the total flow into it equal the total flow out of it: ```tikz \usepackage{tikz-cd} \begin{document} \begin{tikzcd} A\arrow{dd}{y} \arrow{dr}{4}& & B \arrow{ll}{x} \arrow{dl}{3} \\ & C \arrow{ld}{2} \arrow{rd}{z}& \\ D \arrow{rr}{u} & & E\arrow{uu}{w} \end{tikzcd} \end{document} ``` Then at each junction $A,B,C,D,E$ we can set up five equations: $$ \left\{ \begin{array}{cl} A: & x = y + 4 \\ B: & w = x + 3 \\ C: & 4 + 3 = z + 2 \\ D: & y + 2 = u \\ E: & z + u = w \end{array} \right. $$which we can write out an augmented matrix for it (remember to organize the variables!): $$ \begin{array}{} x \ \ \ \ \ y \ \ \ \ \ z \ \ \ \ \ \ w\ \ \ \ \ \ u\qquad\quad\quad\\ \begin{bmatrix} 1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 1 & 0 & 0 & -1 & 0 & \vdots & -3 \\ 0 & 0 & 1 & 0 & 0 & \vdots & 5 \\ 0 & 1 & 0 & 0 & -1 & \vdots & -2 \\ 0 & 0 & 1 & -1 & 1 & \vdots & 0 \end{bmatrix} \end{array} $$And we can perform elementary row operations to obtain an echelon form:$$ \begin{array}{} & \begin{bmatrix} 1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 1 & 0 & 0 & -1 & 0 & \vdots & -3 \\ 0 & 0 & 1 & 0 & 0 & \vdots & 5 \\ 0 & 1 & 0 & 0 & -1 & \vdots & -2 \\ 0 & 0 & 1 & -1 & 1 & \vdots & 0 \end{bmatrix} & \stackrel{\text{row}}\sim & \begin{bmatrix} 1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 0 & 1 & 0 & -1 & 0 & \vdots & -7 \\ 0 & 0 & 1 & 0 & 0 & \vdots & 5 \\ 0 & 1 & 0 & 0 & -1 & \vdots & -2 \\ 0 & 0 & 1 & -1 & 1 & \vdots & 0 \end{bmatrix} \\ \\ \stackrel{\text{row}}\sim & \begin{bmatrix} 1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 0 & 1 & 0 & -1 & 0 & \vdots & -7 \\ 0 & 0 & 1 & 0 & 0 & \vdots & 5 \\ 0 & 0 & 0 & 1 & -1 & \vdots & 5 \\ 0 & 0 & 1 & -1 & 1 & \vdots & 0 \end{bmatrix} & \stackrel{\text{row}}\sim & \begin{bmatrix} 1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 0 & 1 & 0 & -1 & 0 & \vdots & -7 \\ 0 & 0 & 1 & 0 & 0 & \vdots & 5 \\ 0 & 0 & 0 & 1 & -1 & \vdots & 5 \\ 0 & 0 & 0 & -1 & 1 & \vdots & -5 \end{bmatrix} \\ & x \ \ \ \ \ y \ \ \ \ \ z \ \ \ \ \ \ w\ \ \ \ \ \ u\qquad\quad\quad\\ \stackrel{\text{row}}\sim & \begin{bmatrix} \colorbox{lightblue}1 & -1 & 0 & 0 & 0 & \vdots & 4 \\ 0 & \colorbox{lightblue}1 & 0 & -1 & 0 & \vdots & -7 \\ 0 & 0 & \colorbox{lightblue}1 & 0 & 0 & \vdots & 5 \\ 0 & 0 & 0 & \colorbox{lightblue}1 & -1 & \vdots & 5 \\ 0 & 0 & 0 & 0 & 0 & \vdots & 0 \end{bmatrix} \end{array} $$ Now we see that $u$ is a free variable. And so solving backwards with back-substitution, we get $$ \begin{array}{ccl} u&=&\text{free} \\ w&=&5+u \\ z&=&5 \\ y & = & -7+w = -2+u \\ x & = & 4+y = 2+u \end{array} $$(remember we can write every pivoted variables in terms of the free one, $u$ in this case.) What does this mean? This means this network has many possible flow assignments so that at each junction the total flow in is equal to total flow out. namely,$$ (x,y,z,w,u) = (2+u,-2+u,5,5+u,u), \quad\text{where $u$ is free.} $$And if $u$ is allowed to be any real number, then there are infinitely many possible flow assignments. ## Example. Balancing chemical equations. In chemistry we have equations that looks like this $$ 2H_{2} + O_{2} \to 2H_{2}O $$ Here $H_{2}$ means a molecule made of two $H$ (hydrogen) atoms. And $2H_{2}$ means two such $H_{2}$ molecules, for a total of 4 $H$ atoms. Here $O_{2}$ means a molecule made of two $O$ (oxygen) atoms. And $H_{2} O$ is a molecule made of two $H$ atoms and one $O$ atom. And $2H_{2} O$ means two such $H_{2}O$ molecules, for a total of four $H$ atoms and two $O$ atoms. Notice this chemical equation is **balanced** because the number of each atom is the same on the left side of the arrow as the right side of the arrow: On the left we have four $H$'s and two $O$'s; and on the right there are four $H$'s and two $O$'s. Notice if we scale up everything by $5$, say $$ 10H_{2} + 5 O_{2} \to 10 H_{2}O $$this is also balanced, but it is not **most reduced**. So sometimes we like to write out the coefficients such that they are integers and that they are most reduced, like $2H_{2}+O_{2}\to2H_{2}O$. Ok, let us try to balance the following equation:$$ CH_{4} + O_{2} \to CO_{2} + H_{2}O $$ Let us try to find coefficients $x,y,z,w$ such that $$ xCH_{4} + y O_{2} \to zCO_{2} + w H_{2}O $$is balanced **and** the numbers $x,y,z,w$ are all positive integers and most reduced (so their greatest common factor is $1$). We set up an equation for each atom:$$ \begin{array}{cl} C: & x =z \\ H: & 4x = 2w \\ O: & 2y = 2z + w \\ \end{array} $$which gives the following augmented matrix, $$ \begin{array}{} x\ \ \ \ y \ \ \ \ \ z \ \ \ \ \ w \ \quad\qquad\\ \begin{bmatrix} 1 & 0 & -1 & 0 & \vdots & 0 \\ 4 & 0 & 0 & -2 & \vdots & 0 \\ 0 & 2 & -2 & -1 & \vdots & 0 \end{bmatrix} \end{array} $$which we can row reduce to an echelon form $$ \stackrel{\text{row}}\sim \begin{bmatrix} 1 & 0 & -1 & 0 & \vdots & 0 \\ 0 & 0 & 4 & -2 & \vdots & 0 \\ 0 & 2 & -2 & -1 & \vdots & 0 \end{bmatrix} \stackrel{\text{row}}\sim \begin{bmatrix} \colorbox{lightblue}1 & 0 & -1 & 0 & \vdots & 0 \\ 0 & \colorbox{lightblue}2 & -2 & -1 & \vdots & 0 \\ 0 & 0 & \colorbox{lightblue}4 & -2 & \vdots & 0 \end{bmatrix} $$so we have $w$ free, and solving backwards with everything solved in terms of $w$, we have $$ \begin{array}{ccl} w & = & \text{free} \\ z & = & \frac{w}{2} \\ y & = & z + \frac{w}{2} = w \\ x & = & z = \frac{w}{2} \end{array} $$So we have $$ (x,y,z,w) = \left( \frac{w}{2}, w, \frac{w}{2}, w \right), \quad\text{where $w$ is free} $$ Now to give a set of integer coefficients $x,y,z,w$ such that they are all integers and most reduced, we pick $w=2$. So we have $(x,y,z,w)=(1,2,1,2)$, and get $$ CH_{4} + 2 O_{2} \to CO_{2} + 2 H_{2}O $$We can check that it is indeed balanced, with most reduced set of integer coefficients! Remark. Sometimes when the chemical equation is simple enough, one can just balance it "by inspection". However when it gets complicated, this gives a systematic way to approach it!